package com.todo.common.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author azhebuxing
 * @date 2024/4/22 16:40
 * @description
 */
@Getter
@AllArgsConstructor
public enum EnableTypeEnum {

    FORBIDDEN(0, "FORBIDDEN", "禁用"),
    ENABLE(1, "ENABLE", "启用"),

    ;

    private static Map<Integer, EnableTypeEnum> typeMap = Arrays
            .stream(EnableTypeEnum.values())
            .collect(Collectors.toMap(EnableTypeEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static EnableTypeEnum getByType(Integer type) {
        return typeMap.get(type);
    }
}
